#include "boids.h"

BoidPosition3d::BoidPosition3d(float a_x, float a_y, float a_z, bool randPos)
{	
	if (!randPos)
	{
		x = a_x; y = a_y; z = a_z;
	}
	else
	{
		x = (float)(rand()%(int)a_x - (int)a_x/2); 
		y = (float)(rand()%(int)a_y - (int)a_y/2);
		z = (float)(rand()%(int)a_z - (int)a_z/2);
		
	}
}

float BoidPosition3d::getDistance(BoidPosition3d& pos)
{
	float distance, dx, dy, dz;

	dx = x - pos.x;
	
	dy = y - pos.y;

	dz = z - pos.z;
	
	distance = sqrt((dx*dx) + (dy*dy) + (dz*dz));

	return distance;

}
void BoidPosition3d::movePosition(BoidVec3d& vec)
{
	x += vec.x;
	y += vec.y;
	z += vec.z;

}